package com.gantzgulch.generics;

/**
 * This class is used for over-riding the type system in Java and casting one
 * object to another. The cast method completely bypasses compile time type
 * checking.
 * 
 */
public class Cast {

    /**
     * Cast <code>object</code> to an inferred type, bypass warnings from the compiler.
     * 
     * <pre>
     * List<?> l1 = .....;
     * List<String> l2 = .....;
     * l2 = Cast.cast(l1);
     * </pre>
     * 
     * @param <T>
     * @param object the object to be type cast
     * @return
     */
    @SuppressWarnings("unchecked")
    public static <T> T cast(Object object) {
        return (T) object;
    }

}
